﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Common;

namespace School.Admin.Admin
{
    public partial class MyPwd : CheckPower
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                lbName.Text = TextBox1.Text = LoginUserName;
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            Model.Users user = new BLL.Users().GetModel(LoginUserId);
            string strpwd = Encryption.GetMD5(pwd.Text.Trim());
            string str = Encryption.GetMD5(pwd1.Text.Trim());
            if (user.MembePassWord != strpwd)
            {
                ScriptHelper.Alert("原密码不正确");
                return;
            }
            else
            {
                user.MembeLoginName = TextBox1.Text.Trim();
                user.MembePassWord = str;
                new BLL.Users().Update(user);
                ScriptHelper.Alert("修改密码成功！");
            }
        }
    }
}